home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutord.EXE
/
FILE1.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-12-04
|
572b
|
22 lines
#include <stdio.h>
main()
{
FILE *fp, *fopen();
static char alpha[] = "abcdefghijklmnopqrstuvwxyz";
char input[80];
if( (fp=fopen("tempfile","w+")) == 0 ){
printf("Could not open the file: %s\n","tempfile");
exit(1);
}
fprintf(fp,"%s",alpha); /* write out alphabet to "tempfile" */
printf("%d characters have been written\n",ftell(fp));
rewind(fp); /* set file positioning pointer to start of file */
fscanf(fp,"%s",input); /* read in file data */
printf("FILE DATA: %s\n",input); /* print out data */
fclose(fp);
}